﻿<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<%@ include file="../common/header.jsp"%>
<script type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>

	<div class="container " style="margin-top: 20px">
		<%@ include file="../common/top.jsp"%>

		<div class="row">
			<div class="col-sm-3">
				<c:set var="menu" value="formalCustomer" />
				<%@ include file="../common/menu.jsp"%>
			</div>
			<div class="col-sm-9">
				<div class="row">
					<div class="col-sm-12">
						<h1 class="page-head-line">正式客户管理</h1>
					</div>
				</div>
				<form class="form-inline" id="searchForm" action="/formalCustomer/list.do"
					method="post">
					<input type="hidden" name="currentPage" id="currentPage" value="1">

					<button type="button" class="btn btn-success inputBtn">
						<span class="glyphicon glyphicon-plus"></span> 添加
					</button>
				</form>

				<table class="table table-striped table-hover">
					<tr>
						<th>编号</th>
						<th>客户姓名</th>
						<th>销售时间</th>
						<th>销售课程</th>
						<th>营销人员</th>
					</tr>

					<c:forEach var="entity" items="${pageInfo.list}">
						<tr>
							<td>${entity.id}</td>
							<td>${entity.customerName}</td>
							<td><fmt:formatDate value="${entity.vdate}" pattern="yyyy-MM-dd HH:mm"/> </td>
							<td>${entity.curriculumName }</td> 
							<td>${entity.sellerName}</td>
						</tr>
					</c:forEach>

				</table>

				<%@ include file="../common/page.jsp"%>
			</div>
		</div>
	</div>
	<!-- 编辑模态框  -->
	<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
		aria-labelledby="inputModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">编辑</h4>
				</div>
				<div class="modal-body">
					<!--填充编辑界面-->
	                <form class="form-horizontal" action="/formalCustomer/saveOrUpdate.do" method="post" id="editForm">
	                    <input type="hidden" name="id"/>
	                    <div class="form-group">
	                        <label class="col-lg-4 control-label">客户：</label>
	                        <div class="col-lg-6">
	                            <select class="form-control" name="customerId">
	                                <c:forEach var="c" items="${customers}">
	                                    <option value="${c.id}">${c.name}</option>
	                                </c:forEach>
	                            </select>
	                        </div>
	                    </div>
	                    <div class="form-group">
	                        <label class="col-lg-4 control-label">课程：</label>
	                        <div class="col-lg-6">
	                            <select class="form-control" name="curriculumId">
	                                <c:forEach var="c" items="${curriculums}">
	                                    <option value="${c.id}">${c.title}</option>
	                                </c:forEach>
	                            </select>
	                        </div>
	                    </div>
	                </form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
					<button type="button" class="btn btn-primary submitBtn">
						保存</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	
<script>
	$(function() {
		//添加和编辑按钮点击事件
		$(".inputBtn").click(function() {
			//弹出编辑模态框
			$("#inputModal").modal("show");
			
		});
		
		$(".submitBtn").click(function() {
			$("#editForm").submit();
		})
	})
</script>
</body>
</html>